package com.ag.lwc.service;

import java.util.List;

import com.ag.bean.TbContact;
import com.ag.bean.TbUserContact;
import com.ag.lwc.dao.UserContactDAO;

/**
 * 用户个人通信录
 * @author user
 *
 */
public class UserContactService {
	private UserContactDAO userContactDAO;

	/**
	 * 查询某个用户的虚拟组
	 * @param uid
	 * @param groupId
	 * @return
	 */
	public List<TbUserContact> findContactByGroup(String uid,int groupId)
	{
		return userContactDAO.findContactByGroup(uid, groupId);
	}
	//查找用户的通信录列表
	public List<TbUserContact> findUseredContact(String uid)
	{
		return userContactDAO.findAllContact(uid);
		
	}
	//查找用户的某一个通信录
	public TbUserContact findUseredContactById(String ucId)
	{
		return userContactDAO.findById(ucId);
		
	}
	public void add(TbUserContact userContact)
	{
		userContactDAO.save(userContact);
	}
	public void update(TbUserContact userContact)
	{
		userContactDAO.attachDirty(userContact);
	}
	public void delete(String ucId)
	{
		System.out.println("要删除的通信录id："+ucId);
		userContactDAO.delete(ucId);
		System.out.println("删除成功");
	}
	public UserContactDAO getUserContactDAO() {
		return userContactDAO;
	}
	public void setUserContactDAO(UserContactDAO userContactDAO) {
		this.userContactDAO = userContactDAO;
	}
}
